﻿<?php
/**
 * @author Nguyen Xuan Hong
 * @copyright 2010
 */
function view_info1($title, $content, $link, $arr_link)
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="20" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content" style="padding-left:10;padding-right:10;">
			<? echo($content); ?>
		</td>
	</tr>
	<?
	if(count($arr_link))
	{
	?>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td height="5">
		</td>
	</tr>
	<tr>
		<td height="20" width="auto" class="header12">
			<? echo($link); ?>
		</td>
	</tr>
	<tr>
		<td>
			<ul>
			<? 
			foreach($arr_link as $title => $link)
			{
			?>
				<li>
					<img src="images/triangle_01.gif" style="padding:3"><a href="<? echo($link); ?>" class="mainlink1"><? echo($title); ?></a>
				</li>
			<? 
			}
			?>
			</ul>
		</td>
	</tr>
	<?
	}
	?>
</table>
<?
}

function view_info_with_attach($title, $content, $attactment, $link, $arr_link)
{
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="20" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content" style="padding-left:10;padding-right:10;">
			<? echo($content); ?>
		</td>
	</tr>
	<?
	if($attactment != "")
	{
		$filename = basename($attactment);
		$filesize = filesize($attactment) /1000;
		$i = strrpos($filename,".");
		if (!$i) 
		{
			return "";
		}
		$l = strlen($filename) - $i;
		$ext = substr($filename,$i+1,$l); 
		
		if($ext == 'doc')
			$imagepath = "/images/word-logo-small.gif";
		else if($ext == 'pdf')
			$imagepath = "/images/pdf-small.gif";
		else
			$imagepath = "/images/data-small.gif";
	?>
	<tr>
		<td width="auto" class="content" style="padding-left:10;padding-right:10;">
		<span style="font-weight:bold">Tài liệu đính kèm: </span>
		<br>
		<span style="font-style:italic"><a href="<? echo($attactment); ?>"> <img src="<? echo($imagepath); ?>" height="16" height="16"> <? echo($filename); ?></a>(<? echo($filesize); ?> KB)</span>
		</td>
	</tr>
	<?
	}
	?>
	<?
	if(count($arr_link))
	{
	?>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td height="5">
		</td>
	</tr>
	<tr>
		<td height="20" width="auto" class="header12">
			<? echo($link); ?>
		</td>
	</tr>
	<tr>
		<td>
			<ul>
			<? 
			foreach($arr_link as $title => $link)
			{
			?>
				<li>
					<img src="images/triangle_01.gif" style="padding:3"><a href="<? echo($link); ?>" class="mainlink1"><? echo($title); ?></a>
				</li>
			<? 
			}
			?>
			</ul>
		</td>
	</tr>
	<?
	}
	?>
</table>
<?
}

function view_list_lesson_class($title, $arr_class, $branch_id)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($arr_class);
			if($count)
			{
				$col = 4;
				$row = ($count / $col) + 1;
				$k = 1;
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						for( $i = 1; $i <= $row; $i++)
						{
						?>
									<tr>
								<?
								for($j = 1; $j <= $col; $j++)
								{
									$pClsClass = $arr_class[$k];
									$k++;
								?>
										<td width="120" align="center">
										<? 
										if($pClsClass)
										{
										?>
										<a href="?page=lesson&branch=<? echo($branch_id);?>&class=<? echo($pClsClass->value('id'));?>" class="mainlink1">
											<img src="images/folder.png" width="100" width="100">
											<div><? echo($pClsClass->value('name'));?></div>
										</a>
										<? 
									}
									?>
										</td>
									<?	
								}
								?>
									</tr>
								<?
							} 
							?>
					</table>
					<?
				}
				?>
		</td>
	</tr>
</table>
<?
}
?>

<?
function view_list_lesson_subject($title, $arr_subject, $branch_id, $class_id)
{
	?>
								<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="auto" height="30" class="header14" align="center">
											<? echo($title); ?>
										</td>
									</tr>
									<tr>
										<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
										</td>
									</tr>
									<tr>
										<td width="auto" class="content">
											<? 
											$count = count($arr_subject);
											if($count)
											{
												$col = 4;
												$row = ($count / $col) + 1;
												$k = 1;
											?>
													<table width="100%" border="0" cellpadding="0" cellspacing="0">
														<?
														for( $i = 1; $i <= $row; $i++)
														{
														?>
																	<tr>
																<?
																for($j = 1; $j <= $col; $j++)
																{
																	$pClsSubject = $arr_subject[$k];
																	$k++;
																?>
																		<td width="120" align="center">
																		<? 
																		if($pClsSubject)
																		{
																		?>
																		<a href="?page=lesson&branch=<? echo($branch_id);?>&class=<? echo($class_id);?>&subject=<? echo($pClsSubject->value('id'));?>" class="mainlink1">
																			<img src="images/folder.png" width="100" width="100">
																			<div><? echo($pClsSubject->value('name'));?></div>
																		</a>
																		<? 
																	}
																	?>
																		</td>
																	<?	
																}
																?>
																	</tr>
																<?
															} 
															?>
													</table>
													<?
												}
												?>
										</td>
									</tr>
								</table>
<?
}
?>

<?
function view_list_album($title, $listalbum, $branch_id)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td width="auto" height="30" class="header14" align="center">
											<? echo($title); ?>
										</td>
									</tr>
									<tr>
										<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
										</td>
									</tr>
									<tr>
										<td width="auto" class="content">
											<? 
											$count = count($listalbum);
											if($count)
											{
												$col = 4;
												$row = ($count / $col) + 1;
												$k = 1;
											?>
													<table width="100%" border="0" cellpadding="0" cellspacing="0">
														<?
														for( $i = 1; $i <= $row; $i++)
														{
														?>
																	<tr><td height="5"></td></tr>
																	<tr>
																<?
																for($j = 1; $j <= $col; $j++)
																{
																	if($k==1)
																		$pClsAlbum = current($listalbum);
																	else
																		$pClsAlbum = next($listalbum);
																	$k++;
																?>
																		<td width="120" align="center">
																		<? 
																		if($pClsAlbum)
																		{
																		?>
																				<a title="<? echo($pClsAlbum->value('title'));?>" href="?page=picture&branch=<? echo($pClsAlbum->value('branch_id')); ?>&album=<? echo($pClsAlbum->value('id')); ?>">
																					<img src="<? echo($pClsAlbum->value('image'));?>" width="100" width="100">
																					<div><? echo($pClsAlbum->value('title'));?></div>
																				</a>
																				<? 
																			}
																			?>
																		</td>
																	<?	
																}
																?>
																	</tr>
																<?
															} 
															?>
													</table>
													<?
												}
												?>
										</td>
									</tr>
								</table>
<?
}
?>

<?
function view_album($title, $listpicture, $branch_id)
{
	?>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="auto" height="30" class="header14" align="center">
				<? echo($title); ?>
			</td>
		</tr>
		<tr>
			<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
			</td>
		</tr>
		<tr>
			<td width="auto" class="content" align="center", valign="middle" height="320">
				<script type="text/javascript" src="/wp/swfobject.js"></script>
				<link rel='stylesheet' id='shadowbox-css-css'  href='/wp/shadowbox.css' type='text/css' media='screen' />
				<link rel='stylesheet' id='slideshow-gallery-pro-css'  href='/wp/gallery-css.css' type='text/css' media='all' />
				<script type='text/javascript' src='/wp/jquery.js?'></script>
				<script type='text/javascript' src='/wp/gallery-min.js?ver=3.2.1'></script>
				<?php
				$count = count($listpicture);
				?>
				
				<div id="slideshow-wrapper">
					<div id="fullsize">
						<div id="imgprev" class="imgnav" title="Previous Image"></div>
						<div id="imglink"></div>
						<div id="imgnext" class="imgnav" title="Next Image"></div>
						<div id="sgpro_image"></div>
						<div id="information">
						<h5></h5>
						<p></p>
					</div>
				</div>            
				<div id="thumbnails" class="thumbsbot">
					<div id="slideleft" title="Slide Left"></div>
					<div id="slidearea">
						<div id="thumbslider"></div>
					</div>
					<div id="slideright" title="Slide Right"></div>
					<br style="clear:both; visibility:hidden; height:1px;" />
				</div>
				<ul id="sgpro_slideshow" style="display:none;">
					<?php
					for($i = 0; $i < $count; $i++)
					{
						if($i==0)
							$pClsPicture = current($listpicture);
						else
							$pClsPicture = next($listpicture);
						?>
						<li>
							<h5><? echo($pClsPicture->value('title'));?></h5>
							<h4>tall</h4>
							<h5>lightbox</h5>
							<span><? echo($pClsPicture->value('url')); ?></span>                   
							<p><? echo($pClsPicture->value('description'));?></p>
							<a href="<? echo($pClsPicture->value('url')); ?>" rel="shadowbox[sbpost-715];player=img;" title="Slideshow Gallery 2 Example 1">
							<img style="height:60px;" src="/resize.php?t=ratio&s=90|60&u=<? echo($pClsPicture->value('url')); ?>" alt="slideshow-gallery-2-example-1" />la
							</a>                                
						</li>
						<?php
					}
					?>
				</ul>				
				<script type="text/javascript">
					jQuery.noConflict();
					tid('sgpro_slideshow').style.display = "none";
					tid('slideshow-wrapper').style.display = 'block';
					tid('slideshow-wrapper').style.visibility = 'hidden';	
					jQuery("#fullsize").append('<div id="spinner"><img src="/wp/spinner.gif"></div>');
					tid('spinner').style.visibility = 'visible';
					var sgpro_slideshow = new TINY.sgpro_slideshow("sgpro_slideshow");
					
					jQuery(document).ready(function($) 
					{
						window.setTimeout(function() 
						{
						sgpro_slideshow.slidearray = jsSlideshow;
						sgpro_slideshow.auto = 1;	
						sgpro_slideshow.nolink = 0;
						sgpro_slideshow.nolinkpage = 0;	
						sgpro_slideshow.pagelink="self";
						sgpro_slideshow.speed = 8;
						sgpro_slideshow.imgSpeed = 50;
						sgpro_slideshow.navOpacity = 25;
						sgpro_slideshow.navHover = 70;
						sgpro_slideshow.letterbox = "#FFF";
						sgpro_slideshow.info = "information";
						sgpro_slideshow.infoShow = "S";
						sgpro_slideshow.infoSpeed = 7;
						sgpro_slideshow.left = "slideleft";
						sgpro_slideshow.wrap = "slideshow-wrapper";
						sgpro_slideshow.right = "slideright";
						sgpro_slideshow.link = "linkhover";
						sgpro_slideshow.gallery = "post-312";
						sgpro_slideshow.thumbs = "thumbslider";
						sgpro_slideshow.thumbOpacity = 70;
						sgpro_slideshow.thumbHeight = 75;
						//		sgpro_slideshow.scrollSpeed = 7;
						sgpro_slideshow.scrollSpeed = 7;
						sgpro_slideshow.spacing = 5;
						sgpro_slideshow.active = "#000000";
						sgpro_slideshow.imagesbox = "shadowbox";	
						jQuery("#spinner").remove();
						sgpro_slideshow.init("sgpro_slideshow","sgpro_image","imgprev","imgnext","imglink");
						}, 1000);
						tid('slideshow-wrapper').style.visibility = 'visible';
					});
				</script>
				<div>
					<div class="toggle">
						<br />		
						<script type="text/javascript">
							var jsSlideshow = new Array();
						</script>
					</div>
				</div>
				<div id="cameron2">
				</div> <!--#cameron -->
	<script type='text/javascript' src='/wp/shadowbox.js'></script>
				<script type="text/javascript">
					var shadowbox_conf = 
					{
						autoDimensions: false,
						animateFade: true,
						animate: true,
						animSequence: "sync",
						autoplayMovies: true,
						continuous: false,
						counterLimit: 10,
						counterType: "default",
						displayCounter: true,
						displayNav: true,
						enableKeys: true,
						flashBgColor: "#000000",
						flashParams: {bgcolor:"#000000", allowFullScreen:true},
						flashVars: {},
						flashVersion: "9.0.0",
						handleOversize: "resize",
						handleUnsupported: "link",
						initialHeight: 160,
						initialWidth: 320,
						modal: true,
						overlayColor: "#000",
						showMovieControls: true,
						showOverlay: true,
						skipSetup: false,
						slideshowDelay: 0,
						useSizzle: false,
						viewportPadding: 20
					};
					Shadowbox.init(shadowbox_conf);
				</script>
			</td>
		</tr>
	</table>
<?
}
?>

<?
function view_list_news($title, $listnews)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($listnews);
			if($count)
			{
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						foreach( $listnews as $news)
						{
						?>
							<tr>
								<td width="130">
									<a href="?page=news&id=<? echo($news->value('id'));?>"><img src="<? echo($news->value('image'));?>" style="width:130px;height:100px;padding:2px;float:left;margin-right:5px"></a>
								</td>
								<td valign="top">
									<a href="?page=news&id=<? echo($news->value('id'));?>"><strong><? echo($news->value('title')) ?></strong></a>
									<br>
									<? echo($news->value('description')); ?>
								</td>
							</tr>
						<?
						} 
						?>
					</table>
				<?
				}
				?>
		</td>
	</tr>
</table>
<?
}
?>

<?
function view_list_discuss($title, $listdiscuss)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($listdiscuss);
			if($count)
			{
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						foreach( $listdiscuss as $discuss)
						{
						?>
							<tr>
								<td width="130">
									<a href="?page=discuss&id=<? echo($discuss->value('id'));?>"><img src="<? echo($discuss->value('image'));?>" style="width:130px;height:100px;padding:2px;float:left;margin-right:5px"></a>
								</td>
								<td valign="top">
									<a href="?page=discuss&id=<? echo($discuss->value('id'));?>"><strong><? echo($discuss->value('title')) ?></strong></a>
									<br>
									<? echo($discuss->value('description')); ?>
								</td>
							</tr>
						<?
					} 
					?>
					</table>
				<?
			}
			?>
		</td>
	</tr>
</table>
<?
}
?>

<?
function view_list_inform($title, $listinform)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($listinform);
			if($count)
			{
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						foreach( $listinform as $inform)
						{
						?>
							<tr>
								<td valign="top">
									<a href="?page=inform&id=<? echo($inform->value('id'));?>"><strong><? echo($inform->value('title')) ?></strong></a>
									<br>
									<? echo($inform->value('description')); ?>
								</td>
							</tr>
						<?
					} 
					?>
					</table>
				<?
			}
			?>
		</td>
	</tr>
</table>
<?
}
?>

<?
function view_list_charges($title, $listcharges)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($listcharges);
			if($count)
			{
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						foreach( $listcharges as $charges)
						{
						?>
							<tr>
								<td valign="top">
									<a href="?page=charges&id=<? echo($charges->value('id'));?>"><strong><? echo($charges->value('title')) ?></strong></a>
									<br>
									<? echo($charges->value('description')); ?>
								</td>
							</tr>
						<?
					} 
					?>
					</table>
				<?
			}
			?>
		</td>
	</tr>
</table>
<?
}
?>

<?
function view_list_forms($title, $listforms)
{
	?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="auto" height="30" class="header14" align="center">
			<? echo($title); ?>
		</td>
	</tr>
	<tr>
		<td height="2" width="auto" style="background-image:url(images/hor-line.png)">
		</td>
	</tr>
	<tr>
		<td width="auto" class="content">
			<? 
			$count = count($listforms);
			if($count)
			{
			?>
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<?
						foreach( $listforms as $forms)
						{
						?>
							<tr>
								<td valign="top">
									<a href="?page=forms&id=<? echo($forms->value('id'));?>"><strong><? echo($forms->value('title')) ?></strong></a>
									<br>
									<? echo($forms->value('description')); ?>
								</td>
							</tr>
						<?
					} 
					?>
					</table>
				<?
			}
			?>
		</td>
	</tr>
</table>
<?
}

?>